﻿//
//  Manyou.Toolkit.Friend.cs:
//  Authors:
//	Bryan Chow (cabir.zhou@gmail.com)
//
//
//  No Trademark License- This license does not grant you rights to use any 
//  contributors' name, logo, or trademarks.
//
//  If you bring a patent claim against any contributor over patents that you
//  claim are infringed by the software, your patent license from such 
//  contributor to the software ends automatically.
//
//  If you distribute any portion of the software, you must retain
//  all copyright, patent, trademark, and attribution notices that are present in the software.
//
//  If you distribute any portion of the software in source code form,
//  you may do so only under this license by including a complete copy of this license
//  with your distribution. If you distribute any portion of the software
//  in compiled or object code form, you may only do so under a license that complies with this license.
//
//  The software is licensed "as-is." You bear the risk of using it. 
//  The contributors give no express warranties, guarantees or conditions.
//  You may have additional consumer rights under your local laws which 
//  this license cannot change. To the extent permitted under your local laws,
//  the contributors exclude the implied warranties of merchantability,
//  fitness for a particular purpose and non-infringement.
//

using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using Newtonsoft.Json;

namespace Manyou.Toolkit
{
    /// <summary>
    /// 好友类
    /// </summary>
    public class Friend : SessionWrapper
    {
        [JsonPropertyAttribute("uid")]
        [XmlElement("uid")]
        public string uid;
        public long _uid;
        public long UId
        {
            get { return _uid > 0 ? _uid : Util.GetIntFromString(uid); }
            set { _uid = value;}
        }

        public Friend(long UId, ManyouSession session)
        {
            this.UId = UId;
            this.Session = session;
        }

        public Friend()
        { }

        public User GetUserInfo()
        {
            User[] users = Session.GetUserInfo(new long[] { UId }, User.FIELDS);

            return users[0];
        }
        
        
    }

    /// <summary>
    /// 当前用户类
    /// </summary>
    public class Me : Friend
    {
        public Me(long uid, ManyouSession session)
            : base(uid, session)
        { }

        public Notifications Notifications
        {
            get { return Session.GetNotification(); }
        }
    }
}
